package com.xuecheng.search.application.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.xuecheng.base.model.PageResult;
import com.xuecheng.search.application.service.CourseSearchApplication;
import com.xuecheng.search.application.vo.req.CourseSearchQry;
import com.xuecheng.search.domain.model.CourseSearchDo;
import com.xuecheng.search.domain.model.po.CourseIndex;
import com.xuecheng.search.domain.service.CourseSearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

/**
 * @Author: LiJunXi
 * @Description:
 * @Date: 2024-09-01  10:09
 */
@Service
public class CourseSearchApplicationImpl implements CourseSearchApplication {

    @Autowired
    private CourseSearchService courseSearchService;

    @Value("${elasticsearch.course.index}")
    public String courseIndex;

    @Override
    public PageResult<CourseIndex> list(CourseSearchQry courseSearchQry) {

        return courseSearchService.list(BeanUtil.copyProperties(courseSearchQry, CourseSearchDo.class)
                , courseIndex);
    }
}
